package com.securities.stock.entity.jh;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;

import java.util.List;

public class JhResutl<T> {

    private static  final String SUCCESS_CODE="200";

    private String resultcode;

    private String reason;

    private String result;

    public String getResultcode() {
        return resultcode;
    }

    public void setResultcode(String resultcode) {
        this.resultcode = resultcode;
    }

    public String getReason() {
        return reason;
    }

    public void setReason(String reason) {
        this.reason = reason;
    }

    public String getResult() {
        return result;
    }

    public void setResult(String result) {
        this.result = result;
    }

    public List<T> getList( Class<T> clazz){
        if(SUCCESS_CODE.equals(this.resultcode)){
            return JSON.parseArray(this.result,clazz);
        }
        else {
            return null;
        }
    }
    public Object getArray(){
        if(SUCCESS_CODE.equals(this.resultcode)){
            return JSONArray.parse(this.result);
            // JSON.parseObject(this.result,Map.class);
        }
        else {
            return null;
        }
    }
}
